package com.competition.web.constant;

public class RedisConstant {
    public static final String MODULE_CLASS_DATA = "module-class:";
    public static final String MODULE_COUNT_NUMBER = "module-count:";
    public static final String MODULE_SEARCH_COUNT_NUMBER = "module-s-count:";
    public static final String MODULE_SEARCH_LIST = "module-s-list:";
    public static final String MODULE_List = "module-list:";
    public static final String SMS_CODE = "sms:";
    public static final String EMAIL_CODE = "email:";
    public static final String USER_ID = "user-id:";
    public static final String MOBILE_CODE = "mobile-code:";
    
    
	public static final String TABLE_COMMENT = "m-table-comment:";
	
	public static final String CERTIFICATE_KEY = "crm:";
	
	public static final String TABLE_COLUMN_INFO = "m-table-column:";

	public static final String REGION_KEY = "region:";
	
	public static final String SINGLE_REGION_KEY = "single-region:";
	
	public static final String VISIST_CUSTOMER = "visist-c:";

	
	public static final String LEAVE_KEY = "leave:";
	
	public static final String LEAVE_TO_NORMAL = "leaveToNormal:";

	/**
	 * 生成组合数据，用于结果推到所选员工
	 */
	public static final String VISIT_KEY = "visit:";
	
	/**
	 * 存储 员工到客户公司需要多少时间
	 */
	public static final String VISIT_TO_COMPANY_TIME = "visit-time:";
	
	/**
	 * 存储选择的员工
	 */
	public static final String VISIT_SELECT = "visit-select:";
	
	
	/**
	 * 存储 员工到客户公司需要多少距离
	 */
	public static final String VISIT_TO_COMPANY_DISTANCE = "visit-distance:";
	
	
	/**
	 * 存储 算法结果
	 */
	public static final String ALG_RESULT = "alg-result:";
	
	public static final String ALG_RESULT_TO_DB = "ardb:";
	
	public static final String ASSIGN_DATA = "ass:";
	
	public static final String ADMIN_DATA = "admin:";
	
	/**
	 * 指定谈判人
	 */
	public static final String DESIGNATED_NEGOTIATOR = "designatedNegotiator:";
	
	/**
	 * 存储 当前页数
	 */
	public static final String PAGE_NUM = "page:";
	

	/**
	 * 存储 组织架构架构
	 */
	public static final String ORGANIZE = "data-organize:";
	
	/**
	 * 存储 电邀部员工信息
	 */
	public static final String INVITATION_DEPARTMENT = "data-department:";
	
	
	/**
	 * 存储 符合条件的公司信息
	 */
	public static final String COMPAY_ELIGIBLE_INFO = "eligible:";
	
	/**
	 * 存储公司信息
	 */
	public static final String COMPANY_INFO = "cinfo:";
	
	
	/**
	 * 保存探马城市 搜索条件
	 */
	public static final String SEARCH_CITY_COLUMN = "s-c-c:";

	/**
	 * 
	 */
	public static final String SEARCH_HASH_CITY = "city:";

	/**
	 * 保存锚点企业信息
	 */
	public static final String SAVE_ANCHOR_ENTERPRISE = "save-a:";
	
	/**
	 * 同步缓存已完成
	 */
	public static final String TANMA_COMPLATE_KEY = "tanma-complate:";
	


	/**
	 * 保存锚点企业信息 key
	 * @param token
	 * @return
	 */
	public static String getSaveAnchorEnterprise(String token) {
		return SAVE_ANCHOR_ENTERPRISE + token.replaceAll("Bearer ", "");
	}
	
	/**
	 * 存储 电邀部员工信息
	 * @param token
	 * @return
	 */
	public static String getInvitationDeparment(String token) {
		return INVITATION_DEPARTMENT + token.replaceAll("Bearer ", "");
	}
	
	/**
	 *  存储 符合条件的公司信息
	 * @return
	 */
	public static String getEligibleKey(String token) {
		return COMPAY_ELIGIBLE_INFO + token.replaceAll("Bearer ", "");
	}
	
	/**
	 *  存储 组织架构架构
	 * @return
	 */
	public static String getOrganizeKey() {
		return ORGANIZE;
	}
	
	
	/**
	 * 
	 * @param adminIds
	 * @return
	 */
	public static String getAdminDataKey(Integer[] adminIds) {
		return getCacheKeyByData(adminIds, ADMIN_DATA);
	}
	
	public static String getAssignKey(String token) {
		return ASSIGN_DATA + token.replaceAll("Bearer ", "");
	}
	
	public static String getAlgResultToDBKey(String token) {
		return ALG_RESULT_TO_DB + token.replaceAll("Bearer ", "");
	}
	
	
	public static String getPageNumKey(String token) {
		return PAGE_NUM + token.replaceAll("Bearer ", "");
	}
	
	public static String getAlgResultKey(String token) {
		return ALG_RESULT + token.replaceAll("Bearer ", "");
	}
	
	
	public static String getVisitDistanceKey(String token) {
		return VISIT_TO_COMPANY_DISTANCE + token.replaceAll("Bearer ", "");
	}
	
	
	public static String getVisitTimeKey(String token) {
		return VISIT_TO_COMPANY_TIME + token.replaceAll("Bearer ", "");
	}
	
	public static String getVisitKey(String token) {
		return VISIT_KEY + token.replaceAll("Bearer ", "");
	}
	
	public static String getVisitKeyNoon(String token) {
		return token.replaceAll("Bearer ", "") + "noon";
	}
	
	
	public static String getVisitKeyAfterNoon(String token) {
		return token.replaceAll("Bearer ", "") + "afternoon";
	}
	
	
	public static String getLeaveToNormal() {
		return LEAVE_TO_NORMAL;
	}
	
	
	public static String getLeavekey() {
		return LEAVE_KEY;
	}
	
	
	public static String getVisitCustomerKey(String token) {
		return VISIST_CUSTOMER + token;
	}
	
	public static String getSingleRegionKey(Integer key) {
		return SINGLE_REGION_KEY + key;
	}
	
	public static String getRegionKey(Integer key) {
		return REGION_KEY + key;
	}
	
	public static String getTableColumnInfoKey(String key) {
		return TABLE_COLUMN_INFO + key;
	}

	
	public static String getCertificateKey(int id) {
		return CERTIFICATE_KEY + id;
	}

    
    public static String getTableCommentKey(String key) {
		return TABLE_COMMENT + key;
	}
    

    public static String getSmsByKey(String mobile) {
        return MOBILE_CODE + mobile;
    }

    public static String getEmailKey(String email) {
        return EMAIL_CODE + email;
    }

    public static String getModuleCountSearchKey(Integer pageNum, Integer classId, String moduleName) {
        return MODULE_SEARCH_COUNT_NUMBER + pageNum + classId + moduleName;
    }

    public static String getModuleListSearchKey(Integer pageNum, Integer classId, String moduleName) {
        return MODULE_SEARCH_LIST + pageNum + classId + moduleName;
    }

    public static String getUserIdKey(int id) {
        return MODULE_List + id;
    }

    public static String getModuleListKey(int page) {
        return MODULE_List + page;
    }

    private static String getCacheKeyByData(Integer[] ids, String key) {
        StringBuilder builder = new StringBuilder(key).append("-");
        for (Integer num : ids) {
        	builder.append(String.valueOf(num));
        }
        return builder.toString();
    }
}